package org.csy.generic.test00.demo02.teacherWork;

import java.lang.reflect.InvocationTargetException;

/**
 * @author CSY
 * @date 2025 - 03 - 26
 */
public class GenericTest<T> {
    /**
     * 实例化某个类的对象
     * @param clazz 类的calss对象
     * @return 对象
     */
    public T create(Class<T> clazz) {
        try {
            return clazz.getConstructor().newInstance();
        } catch (Exception e) {
            throw new RuntimeException("实例化失败"+e);
        }
    }
}
